<template>
  <div>
    <div >
      <slot name="title">
      </slot>
    </div>


      <slot name="description">
      <div class="description">
         <img 
        v-if="showImages" 
        :src="cover" 
        class="cover-image"
      >
      <p v-if="showImages" >{{ description }}</p >
      </div>     
    </slot>
  
    <slot name="top"  :items="items">
          <!-- 默认是歌单-->
           <ul class="list">
      <li 
        v-for="(item, index) in items" 
        :key="index" 
      >
          <div v-if="showImages">
            <span >{{ index + 1 }}.</span>
            <img 
              :src="item.picUrl" 
              class="item-image"
            >
            <span>{{ item.name }}</span>
          </div>
            </li>
    </ul>
        </slot>

    
  </div>
</template>

<script>
export default {
  props: {
    description: String,
    cover: String,
    items: {
      type: Array,
    },
    showImages: {
      type: Boolean,
      default: false
    }
  },
}
</script>
<style scoped>
.cover-image {
  width: 120px;
  height: 120px;
  border-radius: 8px;
}
.item-image {
  width: 40px;
  height: 40px;
  border-radius: 4px;

}
.description{
 width: 250px;
}
.list{
list-style: none;
}
</style>
